home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / exampleCode / irix / scripts / README < prev    next >
Encoding:
Text File  |  1994-08-02  |  10.8 KB  |  378 lines

  1.  
  2.            ~4Dgifts/toolbox/src/exampleCode/irix/scripts README
  3.  
  4.  
  5.     contained herein are various c-shell scripts created/used by colleagues
  6.     that might possibly be useful to others, if for no other purpose than
  7.     examples of shell programming source.
  8.  
  9.    
  10. rcs          :  directory of scripts written to facilitate manipulation of
  11.         source trees employing RCS.
  12.  
  13.  
  14. counts         :  reads stdin and tells which header files are called by
  15.                 which source files.
  16.  
  17.                 Synopsis:
  18.                         counts.csh < make.deps
  19.  
  20.         Use:
  21.             Sometimes, it is necessary to add a #define or
  22.             #include file to all the source files in the
  23.             current directory.  If the number of source
  24.             files is large, this can become quite a job.
  25.  
  26.             This script was generated to find which header
  27.             file is included by the largest number of
  28.             source files so that the #define or #include
  29.             can be added to this header file, rather than
  30.             to each of the source files.
  31.  
  32.             The make.deps file is just a list of the
  33.             dependent files as generated for a makefile.
  34.  
  35.             To make the make.deps file, do the following:
  36.  
  37.         cc -M $(CFLAGS) *.[fc] | grep -v '/usr/include' > make.deps
  38.  
  39.  
  40.  
  41.  
  42.  
  43. ddir          : Script which performs an 'ls' showing only
  44.         subdirectories in the current directory.
  45.  
  46.  
  47.  
  48.  
  49.  
  50. edir          : Script which performs an 'ls' showing only executable
  51.         files in the current directory.
  52.  
  53.  
  54.  
  55.  
  56.  
  57. findlogins      scans /usr/adm/SYSLOG for every entry entered by 'login'.  
  58.         It will keep track of each different user and count the 
  59.         number of times each has logged in.
  60.  
  61.                 Synopsis:
  62.                         findlogins [<file>]
  63.                 where:
  64.                         <file>  Optionally specifies the file to scan.
  65.                 If not specified, searches
  66.                 /usr/adm/SYSLOG.
  67.  
  68.         Use:
  69.             This script is useful as a method of keeping
  70.             track of who is using your machine.  It will
  71.             provide a running total of the times people
  72.             log in.  It can be run as a cron job once a
  73.             week (the frequency that SYSLOG is copied to
  74.             oSYSLOG).
  75.  
  76.  
  77.  
  78.  
  79.  
  80. findu        :  scans all libraries and/or object files provided on
  81.                 the command line for undefined symbols.  It is smart
  82.                 enough to match symbols that are defined in other
  83.                 libraries so that only the final undefined list is
  84.                 provided.
  85.  
  86.                 Synopsis:
  87.                         findu lib1.a lib2.a ... libN.a > undef.syms
  88.  
  89.                 Note: As a side function, this script appends to the
  90.                 file /usr/var/tmp/defines.h a list of macros to rename
  91.                 FORTRAN file names so they can be called from C.  For
  92.         example, if a C function calls the FORTRAN routine
  93.         'FORSUB', as in:
  94.  
  95.             forsub (parm1, parm2);
  96.  
  97.         This script will add the following line to the
  98.         /usr/var/tmp/defines.h file:
  99.  
  100.             #define forsub forsub_
  101.  
  102.         Then the file defines.h can be copied and included in
  103.         the C source files.
  104.  
  105.  
  106.  
  107.  
  108.  
  109. getlogins       Simple script gets all the login entries from the system
  110.         log and sorts them.
  111.  
  112.  
  113.  
  114.  
  115.  
  116. movetree      : Script which will move an entire directory tree from
  117.         one place to another.  One of its advantages is that
  118.         it maintains the owner, group and file times for the
  119.         files that are moved.  This script uses tar(1) to
  120.         perform the move.
  121.  
  122.         Synopsis:
  123.             movetree [-v] [-n] <source-dir> [<dest-dir>]
  124.  
  125.         Where:
  126.             -v        Set the -v option on tar.
  127.             -n        Do not delete the source
  128.                     directory tree when done.
  129.             <source-dir>    Full path to the source
  130.                     directory.
  131.             <dest-dir>    If specified, the full
  132.                     path to the directory into
  133.                     which the source directory
  134.                     is to be copied.  This
  135.                     directory must exist.  If
  136.                     not specified, copies to
  137.                     the current directory.
  138.  
  139.  
  140.  
  141.  
  142.  
  143. replace          : Script to replace a string with a new string in a list
  144.         of files.  Sort of a global find-and-replace.
  145.  
  146.         Synopsis:
  147.             replace <search-string> <replace-string> <file-list>
  148.  
  149.         Where:
  150.             <search-string>    Is a regular expression (as
  151.                     used in ed(1)) that is
  152.                     supposed to be found in the
  153.                     list of files.
  154.             <replace-string> Is the string that is to
  155.                     replace <search-string>.
  156.             <file-list>    List of files to perform the
  157.                     search-and-replace on.
  158.  
  159.  
  160.  
  161.  
  162.  
  163. setup          : Startup script for one of the engineers here at SGI.
  164.         This script is called from .cshrc and .login to
  165.         initialize the user's environment.  It performs
  166.         different things depending on whether it is called
  167.         from .cshrc or .login.
  168.  
  169.         This script is provided mostly as an example of things
  170.         that can be done during startup to initialize a user's
  171.         environment and isn't necessarily intended to be used
  172.         (though it can be).
  173.  
  174.         Synopsis:
  175.             Add the following to your .login file:
  176.                 if ( -e setup ) then
  177.                     set login
  178.                     source setup
  179.                     unset login
  180.                 endif
  181.  
  182.             Add the following to your .cshrc file:
  183.                 if ( -e setup ) then
  184.                     set cshrc
  185.                     source setup
  186.                     unset cshrc
  187.                 endif
  188.  
  189.         How to use:
  190.             First, you must edit the file and change the
  191.             definition for 'home_host' to the hostname of
  192.             the user's home machine.  In the environment
  193.             of the originator of this script, he had a
  194.             home machine where he normally worked as well
  195.             as a number of other machines that he had
  196.             access to.  This variable is set to his home
  197.             hostname so that when this script is copied to
  198.             all the other machines, certain things happen
  199.             only on his home machine.
  200.  
  201.             Find the line 'set home_host = heaven' and
  202.             change it to 'set home_host = ???', replacing
  203.             the '???' to the hostname of your home
  204.             machine.
  205.  
  206.         Functions performed:
  207.             The following functions are performed by this
  208.             script:
  209.  
  210.             1)  Determines the terminal type.  If the
  211.                 terminal type cannot be determined, sets
  212.                 it to vt100.  Specifically, this was used
  213.                 when logging in over a modem.
  214.  
  215.             2)  If the environment variable ENVONLY is
  216.                 defined, only performs steps that set up
  217.                 the environment.  This speeds the process
  218.                 for the 'userenv(1)' command which is
  219.                 called by X when the user logs in to the
  220.                 graphics monitor.
  221.  
  222.             3)  If the environment variable INEMACS is
  223.                 defined, does not do pretty printing
  224.                 functions that cause a bunch of control
  225.                 codes to be sent to the screen.  These
  226.                 codes make it difficult for EMACS to parse
  227.                 when found in the '*compilation*' window
  228.                 of EMACS.
  229.  
  230.             4)  Sets the DISPLAY environment variable to
  231.                 the appropriate value.  If this session is
  232.                 a remote login, sets the DISPLAY to the
  233.                 remote machine.  If the session is not an
  234.                 X session, removes the DISPLAY environment
  235.                 variable definition.
  236.  
  237.             5)  Sets the environment variable
  238.                 EMACSLOADPATH.
  239.  
  240.             6)  Sets the environment variable WINEDITOR to
  241.                 use EMACS.
  242.  
  243.             7)  Sets the environment variable LPDEST to
  244.                 the default printer defined.
  245.  
  246.             8)  If Explorer is installed, sets the
  247.                 environment EXPLORERHOME.
  248.  
  249.             9)  If the environment variable XSCREEN is
  250.                 defined and refers to the screen size AND
  251.                 the files $HOME/.Xdefaults_1280 or
  252.                 $HOME/.Xdefaults_1024 exist, sets the
  253.                 environment variable XENVIRONMENT to the
  254.                 appropriate file.  This allows the user to
  255.                 define a different .Xdefaults file to be
  256.                 used depending on the screen size.
  257.  
  258.             10) Sets the PATH environment variable to
  259.                 include directories (but only if they
  260.                 exist).  This function requires the
  261.                 existence of the 'unique' command provided
  262.                 elsewhere on this CD.
  263.  
  264.             11) If run from .cshrc, performs steps 13-15.
  265.  
  266.             12) If run from .login, performs steps 16-17.
  267.  
  268.             13) Sets the prompt to include the hostname,
  269.                 username and history.  If the terminal
  270.                 type supports colors or highlighting, uses
  271.                 the colors and reverse video if running
  272.                 with root privileges.
  273.  
  274.             14) Sets a number of csh variables.
  275.  
  276.                 a) history - to keep a history of
  277.                    commands to be re-used with csh's
  278.                    history mechanism.
  279.                 b) cdpath - Includes subdirectories to
  280.                    automatically be searched when the
  281.                    'cd' command is entered.
  282.                 c) filec - enables file completion.
  283.                 d) fignore - lists files to be ignored
  284.                    during file completion.
  285.  
  286.             15) Sets a number of aliases.
  287.  
  288.                 a) ls - To print with specific
  289.                    options.
  290.                 b) ll - Same as 'ls' with -l option.
  291.                 c) lt - Same as 'll' with -t option.
  292.                 d) mail - Points to BSD mailer.
  293.                 e) If using X, sets up to run EMACS,
  294.                    epoch and zmail automatically in
  295.                    the background.
  296.                 f) If not using X, sets up EMACS to
  297.                    run in vt100 mode and disables
  298.                    epoch.
  299.                 g) If the scripts exist, aliases co,
  300.                    col and ci to the appropriate
  301.                    scripts (see the 'rcs' subdirectory
  302.                    in this subdirectory).
  303.                 h) unlock - Performs an unlock on an
  304.                    RCS file and removes the working
  305.                    file.
  306.                 i) If running in the X window system,
  307.                    creates the aliases in steps j-k.
  308.                 j) seticon - Command to set the string
  309.                    to be used as the label for the
  310.                    icon for this shell window.
  311.                 k) settitle - Command to set the
  312.                    string to be used as the title for
  313.                    this shell window.
  314.                 l) If running in the X window system,
  315.                    creates the aliases in steps m-r so
  316.                    they run their equivalent command
  317.                    but when they complete, resets the
  318.                    title of the window to indicate the
  319.                    current working directory.  If the
  320.                    environment variable CONSOLE is
  321.                    true, also adds information to the
  322.                    title to indicate it is the console
  323.                    window.
  324.                 m) cu
  325.                 n) cd
  326.                 o) rlogin
  327.                 p) rsh
  328.                 q) pushd
  329.                 r) popd
  330.                 s) etags - Always include the -t
  331.                    option.
  332.                 t) snoop - Run the demo snoop.
  333.                 u) bu - Backs up one directory.  This
  334.                    is different from 'cd ..' in that
  335.                    it works if the current directory
  336.                    was accessed through a symbolic
  337.                    link.
  338.  
  339.             16) Sets an initial title for the window.
  340.  
  341.             17) Because of conflicts with EMACS, unbinds
  342.                 the SGI definitions for the function keys
  343.                 f3 and f4.
  344.  
  345.  
  346.  
  347.  
  348.  
  349. treegrep        fgrep a string through an entire directory tree.
  350.                 
  351.                 Synopsis:
  352.                         treegrep <dir> <str> <file-spec>
  353.                 
  354.                 Where:
  355.                         <dir>   is the top directory to start in.
  356.                         <str>   is the string to fgrep for.
  357.                         <file-spec> is the file specification to fgrep 
  358.                 through.  Note wild cards must be escaped.
  359.  
  360.  
  361.  
  362.  
  363.  
  364. update.hosts  : This script is used by an engineer to make sure that
  365.         his window/shell environment is the same on all the
  366.         machines in his network.  It is run nightly in a cron
  367.         job to make sure that anything changed on his home
  368.         machine is copied to all the other machines on the
  369.         network that the engineer has access to.
  370.  
  371.         Synopsis:
  372.             update.hosts [<host>]
  373.  
  374.         Description:
  375.             If run without parameters, uses the list of
  376.             hosts in the $HOME/.rhosts file.  Otherwise,
  377.             updates the information on the host specified.
  378.